#ifndef __SERIAL_H__
#define __SERIAL_H__

#define ESERIALOPENERR  0x10
#define ESERIALBAUDERR  0x11
#define ESERIALCSERR    0x12
#define ESERIALSTBERR   0x13
#define ESERIALRDERR    0x14
#define ESERIALWRERR    0x15

int serial_init(const char *devpath, speed_t speed, int databits, char parity, int stopbits, unsigned int timeout);
void serial_exit(void);
void serial_close(int dev);
int serial_recv(int dev, unsigned char *buf, unsigned int len);
int serial_send(int dev, const unsigned char *buf, unsigned int len);

#endif
